TEXT ·_lookup_subrange_neon(SB), $0-32
  MOVD input+0(FP),  R0
  MOVD output+8(FP), R1
  MOVD range_upper+16(FP), R2
  MOVD table+24(FP),R3
  MOVD ranges+32(FP),R4
  MOVD chunks+40(FP),R5

  WORD $0x11003ca8   // ADDW $15, R5, R8
  WORD $0x710000bf   // CMPW $0, R5
  WORD $0x1a85b108   // CSELW LT, R8, R5, R8
  WORD $0x13047d08   // ASRW $4, R8, R8
  WORD $0x710040bf   // CMPW $16, R5
  WORD $0x540003eb   // BLT 31(PC)
  WORD $0x2a0803e9   // MOVW R8, R9
  WORD $0x7100009f   // CMPW $0, R4
  WORD $0x540002ad   // BLE 21(PC)
  WORD $0xd280000a   // MOVD $0, R10
  WORD $0x2a0403eb   // MOVW R4, R11
  WORD $0x4f00e420   // VMOVI $1, V0.B16
  WORD $0x3cea7802   // FMOVQ (R0)(R10<<4), F2
  WORD $0x4f00e401   // VMOVI $0, V1.B16
  WORD $0xaa0b03ec   // MOVD R11, R12
  WORD $0xaa0203ed   // MOVD R2, R13
  WORD $0x4ddfc1a3   // VLD1R 1(R13), [V3.B16]
  WORD $0x6e233443   // VCMHI V3.B16, V2.B16, V3.B16
  WORD $0x4e201c63   // VAND V0.B16, V3.B16, V3.B16
  WORD $0x4e238421   // VADD V3.B16, V1.B16, V1.B16
  WORD $0xf100058c   // SUBS $1, R12, R12
  WORD $0x54ffff61   // BNE -5(PC)
  WORD $0x3dc00062   // FMOVQ (R3), F2
  WORD $0x4e010041   // VTBL V1.B16, [V2.B16], V1.B16
  WORD $0x3caa7821   // FMOVQ F1, (R1)(R10<<4)
  WORD $0x9100054a   // ADD $1, R10, R10
  WORD $0xeb09015f   // CMP R9, R10
  WORD $0x54fffe21   // BNE -15(PC)
  WORD $0x14000008   // JMP 8(PC)
  WORD $0x4f00e400   // VMOVI $0, V0.B16
  WORD $0xaa0103ea   // MOVD R1, R10
  WORD $0x3dc00061   // FMOVQ (R3), F1
  WORD $0x4e000021   // VTBL V0.B16, [V1.B16], V1.B16
  WORD $0x3c810541   // FMOVQ.P F1, 16(R10)
  WORD $0xf1000529   // SUBS $1, R9, R9
  WORD $0x54ffff81   // BNE -4(PC)
  WORD $0x937c7d09   // SBFIZ $4, R8, $32, R9
  WORD $0x6b05013f   // CMPW R5, R9
  WORD $0x5400102a   // BGE 129(PC)
  WORD $0x7100049f   // CMPW $1, R4
  WORD $0x540009eb   // BLT 79(PC)
  WORD $0x93407d28   // SXTW R9, R8
  WORD $0x93407ca9   // SXTW R5, R9
  WORD $0x2a0403ea   // MOVW R4, R10
  WORD $0x927b694b   // AND $4294967264, R10, R11
  WORD $0x9100404c   // ADD $16, R2, R12
  WORD $0x4f00e420   // VMOVI $1, V0.B16
  WORD $0x14000007   // JMP 7(PC)
  WORD $0x92401dcd   // AND $255, R14, R13
  WORD $0x386d686d   // MOVBU (R3)(R13), R13
  WORD $0x3828682d   // MOVB R13, (R1)(R8)
  WORD $0x91000508   // ADD $1, R8, R8
  WORD $0xeb09011f   // CMP R9, R8
  WORD $0x54000e40   // BEQ 114(PC)
  WORD $0x3868680d   // MOVBU (R0)(R8), R13
  WORD $0x7100809f   // CMPW $32, R4
  WORD $0x54000082   // BCS 4(PC)
  WORD $0xd2800010   // MOVD $0, R16
  WORD $0x5280000e   // MOVW $0, R14
  WORD $0x14000034   // JMP 52(PC)
  WORD $0x4e040da2   // VDUP R13, V2.S4
  WORD $0x4f00e401   // VMOVI $0, V1.B16
  WORD $0xaa0b03ee   // MOVD R11, R14
  WORD $0xaa0c03ef   // MOVD R12, R15
  WORD $0x4f00e403   // VMOVI $0, V3.B16
  WORD $0xad7f95e4   // FLDPQ -16(R15), (F4, F5)
  WORD $0x0f08a486   // VSXTL V4.B8, V6.H8
  WORD $0x0f10a4c7   // VSXTL V6.H4, V7.S4
  WORD $0x4f10a4c6   // VSXTL2 V6.H8, V6.S4
  WORD $0x4f08a484   // VSXTL2 V4.B16, V4.H8
  WORD $0x0f10a490   // VSXTL V4.H4, V16.S4
  WORD $0x4f10a484   // VSXTL2 V4.H8, V4.S4
  WORD $0x0f08a4b1   // VSXTL V5.B8, V17.H8
  WORD $0x0f10a632   // VSXTL V17.H4, V18.S4
  WORD $0x4f10a631   // VSXTL2 V17.H8, V17.S4
  WORD $0x4f08a4a5   // VSXTL2 V5.B16, V5.H8
  WORD $0x0f10a4b3   // VSXTL V5.H4, V19.S4
  WORD $0x4f10a4a5   // VSXTL2 V5.H8, V5.S4
  WORD $0x4ea43444   // VCMGT V4.S4, V2.S4, V4.S4
  WORD $0x4eb03450   // VCMGT V16.S4, V2.S4, V16.S4
  WORD $0x0e612a10   // VXTN V16.S4, V16.H4
  WORD $0x4e612890   // VXTN2 V4.S4, V16.H8
  WORD $0x4ea63444   // VCMGT V6.S4, V2.S4, V4.S4
  WORD $0x4ea73446   // VCMGT V7.S4, V2.S4, V6.S4
  WORD $0x0e6128c6   // VXTN V6.S4, V6.H4
  WORD $0x4e612886   // VXTN2 V4.S4, V6.H8
  WORD $0x0e2128c4   // VXTN V6.H8, V4.B8
  WORD $0x4e212a04   // VXTN2 V16.H8, V4.B16
  WORD $0x4e201c84   // VAND V0.B16, V4.B16, V4.B16
  WORD $0x4ea53445   // VCMGT V5.S4, V2.S4, V5.S4
  WORD $0x4eb33446   // VCMGT V19.S4, V2.S4, V6.S4
  WORD $0x0e6128c6   // VXTN V6.S4, V6.H4
  WORD $0x4e6128a6   // VXTN2 V5.S4, V6.H8
  WORD $0x4eb13445   // VCMGT V17.S4, V2.S4, V5.S4
  WORD $0x4eb23447   // VCMGT V18.S4, V2.S4, V7.S4
  WORD $0x0e6128e7   // VXTN V7.S4, V7.H4
  WORD $0x4e6128a7   // VXTN2 V5.S4, V7.H8
  WORD $0x0e2128e5   // VXTN V7.H8, V5.B8
  WORD $0x4e2128c5   // VXTN2 V6.H8, V5.B16
  WORD $0x4e201ca5   // VAND V0.B16, V5.B16, V5.B16
  WORD $0x4e248421   // VADD V4.B16, V1.B16, V1.B16
  WORD $0x4e258463   // VADD V5.B16, V3.B16, V3.B16
  WORD $0x910081ef   // ADD $32, R15, R15
  WORD $0xf10081ce   // SUBS $32, R14, R14
  WORD $0x54fffb21   // BNE -39(PC)
  WORD $0x4e218461   // VADD V1.B16, V3.B16, V1.B16
  WORD $0x4e31b821   // VADDV V1.B16, V1
  WORD $0x1e26002e   // FMOVS F1, R14
  WORD $0xaa0b03f0   // MOVD R11, R16
  WORD $0xeb0a017f   // CMP R10, R11
  WORD $0x54fff840   // BEQ -62(PC)
  WORD $0x8b10004f   // ADD R16, R2, R15
  WORD $0xcb100150   // SUB R16, R10, R16
  WORD $0x38c015f1   // MOVBW.P 1(R15), R17
  WORD $0x6b1101bf   // CMPW R17, R13
  WORD $0x1a8ed5ce   // CINCW GT, R14, R14
  WORD $0xf1000610   // SUBS $1, R16, R16
  WORD $0x54ffff81   // BNE -4(PC)
  WORD $0x17ffffba   // JMP -70(PC)
  WORD $0x93407ca8   // SXTW R5, R8
  WORD $0xcb09010a   // SUB R9, R8, R10
  WORD $0xf100215f   // CMP $8, R10
  WORD $0x540004e3   // BCC 39(PC)
  WORD $0x8b09002b   // ADD R9, R1, R11
  WORD $0x9100046c   // ADD $1, R3, R12
  WORD $0xeb0c017f   // CMP R12, R11
  WORD $0x54000082   // BCS 4(PC)
  WORD $0x8b08002b   // ADD R8, R1, R11
  WORD $0xeb0b007f   // CMP R11, R3
  WORD $0x54000403   // BCC 32(PC)
  WORD $0xf100815f   // CMP $32, R10
  WORD $0x54000062   // BCS 3(PC)
  WORD $0xd280000b   // MOVD $0, R11
  WORD $0x1400000e   // JMP 14(PC)
  WORD $0x927be94b   // AND $-32, R10, R11
  WORD $0x4d40c060   // VLD1R (R3), [V0.B16]
  WORD $0x8b09002c   // ADD R9, R1, R12
  WORD $0x9100418c   // ADD $16, R12, R12
  WORD $0xaa0b03ed   // MOVD R11, R13
  WORD $0xad3f8180   // FSTPQ (F0, F0), -16(R12)
  WORD $0x9100818c   // ADD $32, R12, R12
  WORD $0xf10081ad   // SUBS $32, R13, R13
  WORD $0x54ffffa1   // BNE -3(PC)
  WORD $0xeb0b015f   // CMP R11, R10
  WORD $0x540002e0   // BEQ 23(PC)
  WORD $0xf27d055f   // TST $24, R10
  WORD $0x540001c0   // BEQ 14(PC)
  WORD $0x927df14c   // AND $-8, R10, R12
  WORD $0x8b09018d   // ADD R9, R12, R13
  WORD $0x8b090169   // ADD R9, R11, R9
  WORD $0x8b090029   // ADD R9, R1, R9
  WORD $0xcb0c016b   // SUB R12, R11, R11
  WORD $0x0d40c060   // VLD1R (R3), [V0.B8]
  WORD $0xfc008520   // FMOVD.P F0, 8(R9)
  WORD $0xb100216b   // ADDS $8, R11, R11
  WORD $0x54ffffa1   // BNE -3(PC)
  WORD $0xaa0d03e9   // MOVD R13, R9
  WORD $0xeb0c015f   // CMP R12, R10
  WORD $0x54000061   // BNE 3(PC)
  WORD $0x14000008   // JMP 8(PC)
  WORD $0x8b090169   // ADD R9, R11, R9
  WORD $0x8b09002a   // ADD R9, R1, R10
  WORD $0xcb090108   // SUB R9, R8, R8
  WORD $0x39400069   // MOVBU (R3), R9
  WORD $0x38001549   // MOVB.P R9, 1(R10)
  WORD $0xf1000508   // SUBS $1, R8, R8
  WORD $0x54ffffa1   // BNE -3(PC)
  WORD $0xd65f03c0   // RET
